<template>
  <div id="app"> 
    <Login v-if="!isLogin" v-on:onLogin="onLogin"></Login>
    <MainPage v-if="isLogin"></MainPage>
  </div>
</template>

<script>
//import HelloWorld from './components/HelloWorld.vue'
import Login from './views/Login.vue'
import MainPage from './views/MainPage.vue'

export default {
  name: 'app',
  components: {
    Login ,
    MainPage
  },
  mounted(){
    var me = this; 
  },
  data(){
    return { 
      isLogin : false
    }
  } ,
  methods:{
    onLogin( res){
      this.isLogin = res;
    }
  } ,
  computed:{
    isLogin_(){
      var res = false;
      try{        
        var loginInfoJson = window.sessionStorage.getItem("loginInfo");
        if( loginInfoJson && loginInfoJson.length>0){
          var info = JSON.parse(loginInfoJson);
          res = info && info.loginTm>0;
        }
      }
      catch(er){
        res = false;
      }
      return res;

    }
  }
}
</script>

<style>
html,body{
  background-color: #eee;
}
#app {
  background-color: #eee;
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50; 
  height: 100%;
}
</style>
